package cn.mw.cmdb.entity;

import cn.mw.components.mongodb.anno.CMDBProperty;
import cn.mw.components.mongodb.anno.CMDBRelations;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.List;

@Data
public class InstanceInfoExtend extends InstanceInfo {
    @CMDBProperty(searchType = PropertyTypeString.ID, keywordSearch = true)
    @CMDBRelations(targetClass = ModelGroupInfo.class, targetField = "name", localField = "groupId", foreignField = "_id")
    @Schema(description = "模型分组名称")
    private String modelGroupName;

    @CMDBProperty(searchType = PropertyTypeString.ID, keywordSearch = true)
    @CMDBRelations(targetClass = ModelInfo.class, targetField = "modelName", localField = "modelId", foreignField = "_id")
    @Schema(description = "模型名称")
    private String modelName;

    @CMDBProperty(searchType = PropertyTypeString.ID, keywordSearch = true)
    @CMDBRelations(targetClass = ModelInfo.class, targetField = "modelType", localField = "modelId", foreignField = "_id")
    @Schema(description = "模型类型")
    private String modelType;

    private String bussiness;

    private String bussinessCatolog;
    @CMDBProperty(searchType = PropertyTypeString.ID, isShow = true, keywordSearch = true)
    @CMDBRelations(targetClass = ModelVendorInfo.class, targetField = "vendorCN", localField = "brandId", foreignField = "_id")
    @Schema(description = "厂商")
    private String vendor;

    @CMDBProperty(searchType = PropertyTypeString.ID, isShow = true, keywordSearch = true)
    @CMDBRelations(targetClass = ModelSpecificationInfo.class, targetField = "specification", localField = "data.mw_specification", foreignField = "_id")
    @Schema(description = "规格型号")
    private String specification;

    @CMDBProperty(searchType = PropertyTypeString.ID, isShow = true, keywordSearch = true)
    @CMDBRelations(targetClass = ModelInfo.class, targetField = "modelName", localField = "financeParentId", foreignField = "_id")
    @Schema(description = "金融元父模型名称")
    private String financeParentModelName;

    @CMDBProperty(searchType = PropertyTypeString.ID, isShow = true, keywordSearch = true)
    @CMDBRelations(targetClass = AssetsInterfaceDTO.class, targetField = "ip", localField = "_id", foreignField = "instanceId",isNeedUnwind = false)
    @Schema(description = "接口Ip")
    private List<String> mw_inBandIps;

}
